package dadaRent;

public class AllCar { //所有车的父类
    public int carNum;
    public String carName;
    public int carPrice;
    public int loadMan;
    public int loadThing;
    public int type; // 0 载人 ，1 载人 载货 ，2 载货
    public AllCar( int carNum,String carName, int carPrice,int loadMan ,int loadThing, int type){
        this.carNum = carNum;
        this.carName = carName;
        this.carPrice = carPrice;
        this.loadMan = loadMan;
        this.loadThing = loadThing;
        this.type =type;
    }
    public void print(){ //用于输出车辆信息
        if(type ==0){
            System.out.printf("%-4s %-10s %-10s %-10s",this.carNum+".",this.carName,this.carPrice+"元/天","载人："+this.loadMan+"人");
        }
        else {
            System.out.printf("%-4s %-10s %-10s %-10s", this.carNum+".",this.carName,this.carPrice+"元/天","载货："+this.loadThing+"吨");
        }

    }
}
